/**
 * 动态插入css
 */

export const loadStyle = url => {
  const link = document.createElement('link')
  link.type = 'text/css'
  link.rel = 'stylesheet'
  link.href = url
  const head = document.getElementsByTagName('head')[0]
  head.appendChild(link)
}

/**
 * 格式化get请求的URL参数
 * @param { url字符串 } url
 */
export function splitUrl (url) {
  var str = url.split('?')[1]
  var items = str.split('&')
  var arr = {}
  var json = {}
  for (var i = 0; i < items.length; i++) {
    arr = items[i].split('=')
    json[arr[0]] = arr[1]
  }
  return json
}
